<?php

App::uses('AppController', 'Controller');

class KategorijeController extends AppController {

    public $uses = array('Page', 'Category');

    public function index($categoryId) {
    
        $category = $this->Category->findById($categoryId);
        if (empty($category)) {
            $this->redirect('/');
        }
		
		$this->pageTitle = $category['Category']['name'];
        $pages    = $this->Page->find('all', array(
            'conditions' => array('Page.category_id' => $categoryId)
        ));
    
        $this->set(compact('category', 'pages'));
    }

}